﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="default.aspx.cs" Inherits="cmi_default" Async="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/controls/usrCarDriverDetails.ascx" TagName="usrCarDriver" TagPrefix="uc4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script src="/includes/jtip.js" type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="/css/pathbar.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpHeader" runat="Server">
    <!--Path Bar | Starts-->
    <div id="pathbar">
        <div id="divLanguage" class="<%$ Resources:General,Language%>" runat="server">
            <div class="ThreeStepOne">
            </div>
        </div>
    </div>
    <!--Path Bar | Ends-->
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpBody" runat="Server">
    <%--<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
    </asp:ScriptManager>--%>
    <div class="topbar">
    </div>
    <div class="body">
        <div class="padding_lr15px">
            <!--Column Content | Start-->
            <div class="col_content">
                <div class="top">
                </div>
                <div class="body">
                    <div class="padding_lr30px">
                        <h1>
                            Compulsory Insurance
                        </h1>
                        <div id="CarForm">
                            <!--Form | Start-->
                            <asp:Label ID="lblMessage" runat="server"></asp:Label>
                            <asp:ValidationSummary ID="vsCMI" runat="server" ValidationGroup="cmi" ShowSummary="True"
                                HeaderText="<%$ Resources:Menu,RequiredValidation%>" CssClass="errorSummary" />
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="lblVehicleType" runat="server" Text="Vehicle Type" /></div>
                            <div class="form_col_2 left">
                                <asp:UpdatePanel runat="server" ID="uplVehicleType">
                                    <ContentTemplate>
                                        <asp:DropDownList ID="ddlVehicleType" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlVehicleType_SelectedIndexChanged">
                                            <asp:ListItem Value="1" Text="Sedan / 4 Doors Pickup (Personal)" />
                                            <asp:ListItem Value="2" Text="Pickup (Personal)" />
                                            <asp:ListItem Value="3" Text="Van (Personal)" />
                                        </asp:DropDownList>
                                        <asp:RequiredFieldValidator ID="rfvVehicleType" ControlToValidate="ddlVehicleType"
                                            CssClass="validationErrorControl" runat="server" InitialValue="-1" ValidationGroup="cmi"
                                            Text="" ErrorMessage=""></asp:RequiredFieldValidator>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label1" runat="server" Text="Select Insurer" /></div>
                            <div class="form_col_2 left">
                                <asp:UpdatePanel runat="server" ID="uplSelectInsurer">
                                    <ContentTemplate>
                                        <asp:DropDownList ID="ddlSelectInsurer" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSelectInsurer_SelectedIndexChanged">
                                        </asp:DropDownList>
                                        <asp:DropDownList ID="ddlSelectPrice" runat="server">
                                        </asp:DropDownList>
                                        <br />
                                        <br />
                                        <asp:Label runat="server" ID="lblNormalPrice" Text="Normal Price: ฿ " Font-Bold="true" />
                                        <asp:Label runat="server" ID="lblNormalPriceAmount" Font-Bold="true" />
                                        <asp:Label runat="server" ID="lblSavePrice" ForeColor="Red" Font-Bold="true" />
                                        <br />
                                        <asp:RequiredFieldValidator ID="rfvSelectInsurer" ControlToValidate="ddlVehicleType"
                                            CssClass="validationErrorControl" runat="server" InitialValue="-1" ValidationGroup="cmi"
                                            Text="" ErrorMessage=""></asp:RequiredFieldValidator>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="lblCarModelYear" runat="server" Text="<%$ Resources:CarInsurance,CarModelYear%>" /></div>
                            <div class="form_col_2 left">
                                <asp:UpdatePanel ID="uplManYear" runat="server">
                                    <ContentTemplate>
                                        <asp:DropDownList ID="ddlManufactYear" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlManufactYear_SelectedIndexChanged">
                                            <asp:ListItem Text="<%$ Resources:CarInsurance,Select%>" Value="-1" />
                                        </asp:DropDownList>
                                        <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvManufactYear"
                                            ControlToValidate="ddlManufactYear" InitialValue="-1" runat="server" ErrorMessage=""
                                            Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="lblCarMakeModel" runat="server" Text="<%$ Resources:CarInsurance,CarMakeModel%>" /></div>
                            <div class="form_col_2 left">
                                <asp:UpdatePanel ID="uplCarInfo" runat="server">
                                    <ContentTemplate>
                                        <asp:DropDownList runat="server" ID="ddlCarMake" Width="120px" AutoPostBack="true"
                                            OnSelectedIndexChanged="ddlCarMake_SelectedIndexChanged">
                                            <asp:ListItem Text="<%$ Resources:CarInsurance,Select%>" Value="-1" />
                                        </asp:DropDownList>
                                        <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvCarMake" ControlToValidate="ddlCarMake"
                                            InitialValue="-1" runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                                        <asp:DropDownList runat="server" Width="260px" ID="ddlModelBodyCCDoor" AutoPostBack="True"
                                            OnSelectedIndexChanged="ddlModelBodyCCDoor_SelectedIndexChanged">
                                            <asp:ListItem Value="-1" Text="<%$ Resources:CarInsurance,Select%>"></asp:ListItem>
                                        </asp:DropDownList>
                                        <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvModelBodyCCDoor"
                                            ControlToValidate="ddlModelBodyCCDoor" InitialValue="-1" runat="server" ErrorMessage=""
                                            Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                                        <asp:Label Visible="false" runat="server" ID="lblModelDesc" />
                                        <asp:Label runat="server" ID="lblCarVehicleType" Text="" Visible="false" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                            <div id="divSumInsured" style="display: none;">
                                <div>
                                    <div class="indicator trebo_font">
                                        <asp:UpdatePanel ID="uplSumInsured" runat="server">
                                            <ContentTemplate>
                                                <asp:Label runat="server" Text="<%$ Resources:CarInsurance,SumInsured%>" ID="lblSumInsuredTitle"
                                                    Visible="false" />
                                                <asp:Label runat="server" ID="lblSumInsured" Text="0" Visible="false" />
                                                <div style="display: none">
                                                    <asp:TextBox ID="txtSumInsured" MaxLength="9" Width="80px" runat="server" />
                                                    <asp:TextBox ID="txtNewSumInsured" MaxLength="9" Width="80px" runat="server" />
                                                    <asp:TextBox ID="txtGroupNo" Text="-1" MaxLength="2" Width="30px" runat="server" />
                                                </div>
                                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvSumInsured"
                                                    InitialValue="0" ControlToValidate="txtSumInsured" runat="server" ErrorMessage=""
                                                    Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                                                <asp:RegularExpressionValidator CssClass="validationErrorControl" ID="revSumInsured"
                                                    ValidationExpression="^\d+$" ControlToValidate="txtSumInsured" runat="server"
                                                    ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RegularExpressionValidator>
                                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvGroupNo" InitialValue="-1"
                                                    ControlToValidate="txtSumInsured" runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </div>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label3" runat="server" Text="Plate" /></div>
                            <div class="form_col_2 left">
                                <asp:TextBox runat="server" ID="txtCarPlate" Width="100px" MaxLength="20" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvCarPlate" ControlToValidate="txtCarPlate"
                                    runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                                <asp:Label ID="Label4" runat="server" Text="Sign Province" />
                                <asp:TextBox runat="server" ID="txtSignProvince" Width="180px" MaxLength="50" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvSignProvince"
                                    ControlToValidate="txtSignProvince" runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label5" runat="server" Text="Chassis No." /></div>
                            <div class="form_col_2 left">
                                <asp:TextBox runat="server" ID="txtChassisNo" Width="180px" MaxLength="50" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvChassisNo" ControlToValidate="txtChassisNo"
                                    runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label6" runat="server" Text="Engine No." /></div>
                            <div class="form_col_2 left">
                                <asp:TextBox runat="server" ID="txtEngineNo" Width="180px" MaxLength="50" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvEngineNo" ControlToValidate="txtEngineNo"
                                    runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label7" runat="server" Text="Engine size" /></div>
                            <div class="form_col_2 left">
                                <asp:TextBox runat="server" ID="txtEngineSize" Width="180px" MaxLength="50" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvEngineSize"
                                    ControlToValidate="txtEngineSize" runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="lblCoverCommencementDate" runat="server" Text="<%$ Resources:CarInsurance,CoverCommencementDate%>" /></div>
                            <div class="form_col_2 left">
                                <asp:DropDownList ID="ddlCoverageComDate" onchange="GetCoverageEndDate()" runat="server">
                                </asp:DropDownList>
                                &nbsp;
                                <asp:Label runat="server" Visible="false" ID="lblCoverageExpireDateTitle" Text="<%$Resources:CarInsurance,CoverExpiryDate %>"
                                    CssClass="font12" />
                                <asp:Label runat="server" Visible="false" ID="lblCoverageExpireDate" CssClass="font12" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvCoverComDate"
                                    runat="server" InitialValue="-1" ControlToValidate="ddlCoverageComDate" ErrorMessage=""
                                    ValidationGroup="cmi" Display="Dynamic"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <br />
                            <div class="form_col_1 left">
                                <asp:Label ID="Label15" runat="server" Font-Bold="true" Text="Insured Details" /></div>
                            <div class="form_col_2 left">
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label8" runat="server" Text="Full Name" /></div>
                            <div class="form_col_2 left">
                                <asp:TextBox runat="server" ID="txtFullName" Width="230px" MaxLength="100" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvFullName" ControlToValidate="txtFullName"
                                    runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label9" runat="server" Text="Insured Address" /></div>
                            <div class="form_col_2 left">
                                <asp:TextBox runat="server" ID="txtInsuredAddress" TextMode="MultiLine" Columns="35"
                                    Rows="3" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvInsuredAddress"
                                    ControlToValidate="txtInsuredAddress" runat="server" ErrorMessage="" Text=""
                                    ValidationGroup="cmi"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label10" runat="server" Text="Email" /></div>
                            <div class="form_col_2 left">
                                <asp:TextBox runat="server" ID="txtEmail" Width="240px" MaxLength="50" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvEmail" ControlToValidate="txtEmail"
                                    runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <div class="form_col_1 left">
                                <asp:Label ID="Label11" runat="server" Text="Mobile No." /></div>
                            <div class="form_col_2 left">
                                <asp:TextBox runat="server" ID="txtMobileNo" Width="180px" MaxLength="50" />
                                <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvMobileNo" ControlToValidate="txtMobileNo"
                                    runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                            </div>
                            <div class="seperator_form">
                            </div>
                            <br />
                            <asp:UpdatePanel runat="server" ID="uplShipping">
                                <ContentTemplate>
                                    <div class="form_col_1 left">
                                        <asp:Label ID="Label12" runat="server" Font-Bold="true" Text="Shipping Details" /></div>
                                    <div class="form_col_2 left">
                                        <asp:CheckBox runat="server" ID="chkAsInsured" Text="Same As Insured" Checked="false"
                                            AutoPostBack="True" OnCheckedChanged="chkAsInsured_CheckedChanged" />
                                    </div>
                                    <div class="seperator_form">
                                    </div>
                                    <div class="form_col_1 left">
                                        <asp:Label ID="Label13" runat="server" Text="Name (recipient)" /></div>
                                    <div class="form_col_2 left">
                                        <asp:TextBox runat="server" ID="txtShipName" Width="200px" MaxLength="100" Rows="3" />
                                        <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvShipName" ControlToValidate="txtShipName"
                                            runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                                    </div>
                                    <div class="seperator_form">
                                    </div>
                                    <div class="form_col_1 left">
                                        <asp:Label ID="Label14" runat="server" Text="Shipping Address" /></div>
                                    <div class="form_col_2 left">
                                        <asp:TextBox runat="server" ID="txtShipAddress" TextMode="MultiLine" Columns="35"
                                            Rows="3" />
                                        <asp:RequiredFieldValidator CssClass="validationErrorControl" ID="rfvShipAddress"
                                            ControlToValidate="txtShipAddress" runat="server" ErrorMessage="" Text="" ValidationGroup="cmi"></asp:RequiredFieldValidator>
                                    </div>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <asp:UpdatePanel runat="server" ID="UpdatePanel1">
                                <ContentTemplate>
                                    <div class="seperator_form">
                                    </div>
                                    <div class="form_col_1 left">
                                        <asp:Label ID="Label2" runat="server" Text="Method" /></div>
                                    <div class="form_col_2 left">
                                        <asp:DropDownList runat="server" ID="ddlShipMethod" AutoPostBack="true" 
                                            onselectedindexchanged="ddlShipMethod_SelectedIndexChanged">
                                            <asp:ListItem Value="1" Text="Registered Mail. (FREE)" />
                                            <asp:ListItem Value="2" Text="Express Mail EMS (ADD ฿ 37.00)" />
                                        </asp:DropDownList>
                                        <br />
                                        <asp:Label runat="server" ID="lblTotalAmountDue" Visible="false" Text="Total Price: ฿ " Font-Bold="true" />
                                    </div>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <div class="seperator_form">
                            </div>
                            <div class="seperator_15px">
                            </div>
                            <div id="divHiddenMonths" style="display: none;">
                                <input runat="server" id="lblJan" type="hidden" value="<%$ Resources:MonthResource, January%>" />
                                <input runat="server" id="lblFeb" type="hidden" value="<%$ Resources:MonthResource, February%>" />
                                <input runat="server" id="lblMar" type="hidden" value="<%$ Resources:MonthResource, March%>" />
                                <input runat="server" id="lblApr" type="hidden" value="<%$ Resources:MonthResource, April%>" />
                                <input runat="server" id="lblMay" type="hidden" value="<%$ Resources:MonthResource, May%>" />
                                <input runat="server" id="lblJun" type="hidden" value="<%$ Resources:MonthResource, June%>" />
                                <input runat="server" id="lblJul" type="hidden" value="<%$ Resources:MonthResource, July%>" />
                                <input runat="server" id="lblAug" type="hidden" value="<%$ Resources:MonthResource, August%>" />
                                <input runat="server" id="lblSep" type="hidden" value="<%$ Resources:MonthResource, September%>" />
                                <input runat="server" id="lblOct" type="hidden" value="<%$ Resources:MonthResource, October%>" />
                                <input runat="server" id="lblNov" type="hidden" value="<%$ Resources:MonthResource, November%>" />
                                <input runat="server" id="lblDec" type="hidden" value="<%$ Resources:MonthResource, December%>" />
                                <input runat="server" id="lblCultureInfo" type="hidden" />
                            </div>
                            <div>
                                <div>
                                    <div class="form_col_1 left">
                                        &nbsp;
                                    </div>
                                    <div class="form_col_2 left">
                                        <asp:Button ID="ibtNext" onmousedown="this.className = 'button_next_mousedown';"
                                            onmouseup="this.className = 'button_next';" onmouseout="this.className = 'button_next';"
                                            CssClass="button_next" OnClientClick="LoadValidationErrorCss();if (Page_ClientValidate('cmi')){ if(confirm('Are you sure to proceed?')){ this.removeAttribute('onmouseout');this.removeAttribute('onmouseup');this.className = 'button_processing';} else {return false;}}"
                                            runat="server" ValidationGroup="cmi" AlternateText="Next" ToolTip="Next" CausesValidation="true"
                                            OnClick="btnNext_Click" />
                                    </div>
                                </div>
                                <div class="seperator_15px">
                                </div>
                                <!--Form | End-->
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bottom">
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
    </div>

    <script type="text/javascript">
        function GetCoverageEndDate() {
            var _commDate = document.getElementById('<%=ddlCoverageComDate.ClientID%>');
            var _expDate = document.getElementById('<%=lblCoverageExpireDate.ClientID%>');
            var now = new Date();
            var next = new Date();
            var month = new Array(12);

            month[0] = document.getElementById('<%=lblJan.ClientID%>').value;  //"January";
            month[1] = document.getElementById('<%=lblFeb.ClientID%>').value; //"February";
            month[2] = document.getElementById('<%=lblMar.ClientID%>').value; // "March";
            month[3] = document.getElementById('<%=lblApr.ClientID%>').value; // "April";
            month[4] = document.getElementById('<%=lblMay.ClientID%>').value; //"May";
            month[5] = document.getElementById('<%=lblJun.ClientID%>').value; // "June";
            month[6] = document.getElementById('<%=lblJul.ClientID%>').value; //"July";
            month[7] = document.getElementById('<%=lblAug.ClientID%>').value; //"August";
            month[8] = document.getElementById('<%=lblSep.ClientID%>').value; //"September";
            month[9] = document.getElementById('<%=lblOct.ClientID%>').value; //"October";
            month[10] = document.getElementById('<%=lblNov.ClientID%>').value; //"November";
            month[11] = document.getElementById('<%=lblDec.ClientID%>').value; //"December";
            //alert(_commDate.value);
            var strCommDate = _commDate.value;
            if (strCommDate != "-1") {
                var strDay = strCommDate.substring(0, 2);
                //var strMonth = (parseInt(strCommDate.substring(2, 4)) - 1).toString();
                var strMonth = strCommDate.substring(2, 4) - 1;
                var strYear = strCommDate.substring(4, 8);
                //alert(strYear + "/" + strMonth + "/" + strDay);
                now.setFullYear(strYear, strMonth, strDay);
                next.setFullYear((parseInt(strYear) + 1).toString(), strMonth, (now.getDate()).toString());

                var strExpiryDate = next.getDate() + "/" + month[next.getMonth()] + "/" + next.getFullYear();

                //alert(strCommDate);
                //alert(strDay + ' ' + strMonth + ' ' + strYear);
                //alert(now);

                if (document.getElementById('<%=lblCultureInfo.ClientID%>').value == 'th-TH') {
                    strExpiryDate = next.getDate() + "/" + month[next.getMonth()] + "/" + (next.getFullYear() + 543);
                }
                else {
                    strExpiryDate = next.getDate() + "/" + month[next.getMonth()] + "/" + next.getFullYear();
                }

                //_expDate.innerHTML = strExpiryDate;
                // alert(next.getFullYear() + 543);

            }
            else {
                //_expDate.innerHTML = "";
            }
            //Cover Expiry Date: 22/Mar/2012
        }
    </script>

</asp:Content>
